package com.leedcode;

import java.util.HashSet;

/*
* LeedCode   面试题 01.01---判定字符是否唯一
* */

public class LeedCode01_01 {
    public static void main(String[] args) {
        String s = "abc";
        boolean res = isUnique(s);
        System.out.println(res);
    }
    public static boolean isUnique(String astr) {
        HashSet<Character> hashSet = new HashSet<>();
        for (int i = 0; i < astr.length(); i++) {
            Character ch = astr.charAt(i);
            hashSet.add(ch);
        }
        if(hashSet.size() == astr.length()){
            return true;
        }else {
            return  false;
        }
    }
}
